package com.hl.springboothome1.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.springboothome1.entity.Article;
import com.hl.springboothome1.entity.ArticleType;
import com.hl.springboothome1.mapper.ArticleTypeMapper;
import com.hl.springboothome1.service.ArticleTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class ArticleTypeServiceImpl implements ArticleTypeService {
    @Autowired
    ArticleTypeMapper articleTypeMapper;

    @Override
    public int add(ArticleType articleType) {
        int i = articleTypeMapper.add(articleType);
        return i;
    }

    @Override
    public int deleteById(int id) {
        int i = articleTypeMapper.deleteById(id);
        return i;
    }

    @Override
    public int deleteBatch(List list) {
        int i = articleTypeMapper.deleteBatch(list);
        return i;

    }

    @Override
    public int update(ArticleType articleType) {
        int i = articleTypeMapper.update(articleType);
        return i;
    }

    @Override
    public ArticleType selectById(int id) {
        ArticleType id1 = articleTypeMapper.selectById(id);
        return id1;
    }

    @Override
    public PageInfo<ArticleType> selectAll(ArticleType articleType, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ArticleType> articleTypes = articleTypeMapper.selectAll(articleType);
        PageInfo<ArticleType> articleTypePageInfo = new PageInfo<>(articleTypes);
        return articleTypePageInfo;
    }
}
